package ioStream.file.processStream.byteStream;

import java.io.IOException;
import java.io.PrintStream;

/**
 * Created with IntelliJ IDEA
 * Description:标准输出流/打印流学习
 * User:22954
 * Date:2024-03-18
 * Time:20:32
 */
public class PrintStream_ {
    /*
    class System
    public static final PrintStream out = null;
    System.out  编译类型和运行类型都是PrintStream
    System.out表示标准输出流----显示器流
     */
    public static void main(String[] args) throws IOException {
        System.out.println(System.out.getClass());//class java.io.PrintStream

        PrintStream ps = System.out;
        ps.println("haha");//haha
        /*
        println()->print()->write()
         */
        ps.write("hehe".getBytes());//hehe
        /*
        修改打印输出的位置/设备
         */
        System.setOut(new PrintStream("f:/Test/NewFile2.txt"));
        ps = System.out;
        ps.println("Hello!");
        System.out.println("hello world!");

        ps.close();
    }
}
